package dao;

import com.xugou.dao.EmpDao;
import com.xugou.dao.OrderDao;
import com.xugou.pojo.Emp;
import com.xugou.pojo.Order;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;
import java.util.List;

/**
 * @author xugou
 * @date 2022/6/13  20:54
 */
public class OrderTestDao {

    @Test
    public void getOrders() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderDao orderDao = context.getBean("orderDao", OrderDao.class);
        List<Order> allOrder = orderDao.getAllOrder();
        for (Order order : allOrder) {
            System.out.println(order);
        }
    }
    @Test
    public void delOrders() {
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
        OrderDao orderDao = context.getBean("orderDao", OrderDao.class);
        int i = orderDao.deleteOrderById(4);
        System.out.println(i);
    }

}
